<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<html>
<head>
    <meta charset="utf-8">
    <title>员工-基本信息</title>
    <link type="text/css" rel="stylesheet" href="<%=request.getContextPath()%>/static/index/css/style.css"/>
    <link type="text/css" rel="stylesheet" href="<%=request.getContextPath()%>/static/index/css/index.css"/>


    <%
        //获得请求的上下文

        String context = request.getContextPath();
    %>
    <script src="/static/js/jquery-1.12.4.js"></script>
    <!-- 动态菜单JS -->
    <script type="text/javascript" src="/static/js/menu.js"></script>
    <script type="text/javascript" src="/static/js/bootstrap.js"></script>
</head>

<body>

<script>

    function del(username) {
        if (confirm("是否确认删除？")) {
            window.location.href = "/user/userdel?username=" + username;
        }
    }

    window.onload=function () {
        var meg=$("#meg").val();
        if(meg=="del"){
            alert("删除成功！")
        }else  if(meg=="add"){
            alert("添加成功！")
        }else  if(meg=="upd"){
            alert("修改成功！")
        }
    }

</script>
<div class="container">
    <%--顶部公共部分--%>
    <jsp:include page="common/top.jsp"/>
    <div class="left-menu" style="height:949px;">
        <%--左侧菜单列表--%>
        <jsp:include page="common/left-menu-list.jsp"/>
    </div>
    <input type="hidden" value="${meg}" id="meg">
    <div class="right-menu">
        <div class="main-hd">
            <div class="page-teb">
                <div class="l-tab-links">
                    <ul style="left:0;">
                        <li class="l-select">
                            <a href="/user/index">首页</a>
                        </li>
                        <li class="l-select">
                            <a href="#">员工管理</a>
                        </li>
                    </ul>
                </div>

                <div class="l-tab-content" style="background:#fff;">
                    <div class="tab-content-item">
                        <div class="home">
                            <!--员工管理   开始-->
                            <div class="yg-gl">
                                <div class="yg-add">
                                    <form action="<%=context%>/user/userlist" method="get">
                                        <button  class="ui-xz" data-method="offset" ><a href="/user/gl-khgl-tc">新增</a></button>
                                    <%--    <div style="position: absolute">
                                            <label>(支持模糊查询)</label>
                                            <input type="text" name="userName" value="${username}" style="background-color: #fcd895;font-size: 16px"/>
                                            <button type="submit">查找</button></div>--%>
                                    </form>
                                </div>
                                <div class="yg-tab">
                                    <div class="grid">
                                        <div class="layoutitem" style="width:100%;border:none;">
                                            <form method="post">
                                                <table class="gridbar" border="0" cellpadding="0" cellspacing="0">
                                                    <thead>
                                                    <tr>
                                                        <th>姓名</th>
                                                        <th>身证号码</th>
                                                        <th>真实姓名</th>
                                                        <th>性别</th>
                                                        <th>地址</th>
                                                        <th>电话</th>
                                                        <th>职业</th>
                                                        <th>职位</th>
                                                        <th>密码</th>
                                                        <th>QQ号</th>
                                                        <th>注册时间</th>
                                                        <th style="color: #1c2b36">删除</th>
                                                        <th style="color: #1c2b36">修改</th>

                                                    </tr>
                                                    <c:forEach var="list" items="${pageInfo.list}">
                                                        <tr>
                                                            <td>${list.username}</td>
                                                            <td>${list.identity}</td>
                                                            <td>${list.fullname}</td>
                                                            <td>${list.sex}</td>
                                                            <td>${list.address}</td>
                                                            <td>${list.phone}</td>
                                                            <td>${list.position}</td>
                                                            <td>${list.userlevel}</td>
                                                            <td>${list.userpwd}</td>
                                                            <td>${list.userQQ}</td>
                                                            <td>
                                                                <fmt:formatDate  pattern="yyyy-MM-dd" value="${list.USERDLDATE}" /></td>
                                                            <td style="background-color: #9ddcfb;align-content: center">
                                                                <a href="#" onclick="del('${list.username}');">删除</a>
                                                            </td>
                                                            <td style="background-color: #9ddcfb;align-content: center">
                                                                <a href="<%=context%>/user/infolist?username=${list.username}">修改</a>
                                                            </td>
                                                        </tr>
                                                    </c:forEach>
                                                    </thead>
                                                </table>
                                            </form>




                                            <%--<jsp:include page="common/Page.jsp"/>--%>
                                            <%--<%@include file="common/Page.jsp" %>--%><%--该方式导入公共页是和当前的同步导入--%>
                                        </div>




                                    </div>
                                    <%--分页位置--%>

                                    <link  type="text/css" rel="stylesheet"  href="<%=request.getContextPath()%>/static/css/bootstrap.css"/>

                                    <style>
                                        .container{
                                            background: #FFFFFF;
                                            width: 100%;
                                            height: 50%;
                                            padding: 0;

                                        }
                                        th{
                                            text-align: center;
                                        }

                                    </style>

                                    <%--分页位--%>
                                    <!--显示分页信息-->
                                    <div class="row">
                                        <!--文字信息-->
                                        <div class="col-md-6">
                                            <br>
                                            当前第 ${pageInfo.pageNum} 页.总共 ${pageInfo.pages} 页.一共 ${pageInfo.total} 条记录
                                        </div>

                                        <!--点击分页-->
                                        <div class="col-md-6">
                                            <nav aria-label="Page navigation">
                                                <ul class="pagination">

                                                    <li><a href="${pageContext.request.contextPath}/user/userlist?pageNum=1">首页</a></li>

                                                    <!--上一页-->
                                                    <li>
                                                        <c:if test="${pageInfo.hasPreviousPage}">
                                                            <a href="${pageContext.request.contextPath}/user/userlist?pageNum=${pageInfo.pageNum-1}" aria-label="Previous">
                                                                <span aria-hidden="true">«</span>
                                                            </a>
                                                        </c:if>
                                                    </li>

                                                    <!--循环遍历连续显示的页面，若是当前页就高亮显示，并且没有链接-->
                                                    <c:forEach items="${pageInfo.navigatepageNums}" var="page_num">
                                                        <c:if test="${page_num == pageInfo.pageNum}">
                                                            <li class="active"><a href="#">${page_num}</a></li>
                                                        </c:if>
                                                        <c:if test="${page_num != pageInfo.pageNum}">
                                                            <li><a href="${pageContext.request.contextPath}/user/userlist?pageNum=${page_num}">${page_num}</a></li>
                                                        </c:if>
                                                    </c:forEach>

                                                    <!--下一页-->
                                                    <li>
                                                        <c:if test="${pageInfo.hasNextPage}">
                                                            <a href="${pageContext.request.contextPath}/user/userlist?pageNum=${pageInfo.pageNum+1}"
                                                               aria-label="Next">
                                                                <span aria-hidden="true">»</span>
                                                            </a>
                                                        </c:if>
                                                    </li>
                                                    <li><a href="${pageContext.request.contextPath}/user/userlist?pageNum=${pageInfo.pages}">尾页</a></li>
                                                </ul>
                                            </nav>
                                        </div>
                                    </div>
                                    <!--员工管理   结束-->
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</body>
</html>
